class Solution(object):
    def removeElement(self, nums, val):
        """
        :type nums: List[int]
        :type val: int
        :rtype: int
        """
        for i in nums[::-1]:
            if i == val:
                nums.remove(val)
        nums=nums[::-1]
        return f'{len(nums)},nums={nums}'

print(Solution().removeElement(nums  = [0,1,2,2,3,0,4,2], val = 2))